import { Captcha, list, add, detail, del, search, revise } from "./request.js";

// export var updataTea = query => {
//     return new Promise((resolve, reject) => {
//         updata(`/teas/${query.id}`, { name: query.name, type: query.type, price: query.price })
//             .then(res => {
//                 resolve(res);
//             })
//             .catch(err => {
//                 reject(err);
//             });
//     });
// }

// export var baiduwd = query => {
//     return new Promise((resolve, reject) => {
//         // 修改路径，添加新代理前缀
//         baidu(`/baidu-proxy/s?wd=${query.wd}`, query)
//             .then(res => {
//                 resolve(res);
//             })
//             .catch(err => {
//                 reject(err);
//             });
//     });
// };


// export var lianxiangwd = query => {
//     return new Promise((resolve, reject) => {
//         // 修改路径，添加新代理前缀
//         lianxiang(`/api/su?wd=${query.wd}`, query)
//             .then(res => {
//                 resolve(res);
//             })
//             .catch(err => {
//                 reject(err);
//             });
//     });
// };

// export var Capt_cha = (url, query) => {
//     return new Promise((resolve, reject) => {
//         Captcha.get(url, { params: query })
//            .then(res => {
//                 resolve(res);
//             })
//            .catch(err => {
//                 reject(err);
//             });
//     });
// };

export var Capt_cha = query => {
    return new Promise((resolve, reject) => {
        Captcha('http://120.92.101.187/index.php/index/index/getcode', query)
            .then(res => {
                resolve(res);
            })
            .catch(err => {
                reject(err);
            });
    });
};
export var List = query => {
    return new Promise((resolve, reject) => {
        list('http://47.94.4.201/index.php/index/teacher/teacherlist', query)
            .then(res => {
                resolve(res);
            })
            .catch(err => {
                reject(err);
            });
    });
};
export var Add = query => {
    return new Promise((resolve, reject) => {
        add('http://47.94.4.201/index.php/index/index/addteacher', query)
            .then(res => {
                resolve(res);
            })
            .catch(err => {
                reject(err);
            });
    });
};
export var Detail = query => {
    return new Promise((resolve, reject) => {
        detail('http://47.94.4.201/index.php/index/index/getteacherbyid', query)
            .then(res => {
                resolve(res);
            })
            .catch(err => {
                reject(err);
            });
    });
};
export var Del = query => {
    return new Promise((resolve, reject) => {
        del('http://47.94.4.201/index.php/index/teacher/delteacher', query)
            .then(res => {
                resolve(res);
            })
            .catch(err => {
                reject(err);
            });
    });
};
export var Search = query => {
    return new Promise((resolve, reject) => {
        search('http://47.94.4.201/index.php/index/teacher/getsearch', query)
            .then(res => {
                resolve(res);
            })
            .catch(err => {
                reject(err);
            });
    });
};
export var Revise = query => {
    return new Promise((resolve, reject) => {
        revise('http://47.94.4.201/index.php/index/index/upteacher', query)
            .then(res => {
                resolve(res);
            })
            .catch(err => {
                reject(err);
            });
    });
};